package com.cs.base.room;

import androidx.annotation.NonNull;
import androidx.room.ColumnInfo;
import androidx.room.Entity;
import androidx.room.PrimaryKey;

import com.cs.base.util.FormatUtil;


/**
 * @ClassName: MapRoom
 * @Date: 2021/6/11
 * @Author: CS
 * @Description: APP个人缓存数据，以key/value形式保存，key为主键，value为JSON格式内容
 */
@Entity
public class MapRoom {

    //数据存储主键
    @NonNull
    @PrimaryKey
    private String key;

    //数据存储时间(更新时间)
    @ColumnInfo(name = "time")
    private String time;

    //数据存储内容
    @ColumnInfo(name = "value")
    private String value;

    public MapRoom(String key, String value){
        this.key = key;
        this.value = value;
        this.time = FormatUtil.dateTime();
    }

    @NonNull
    public String getKey() {
        return key;
    }

    public void setKey(@NonNull String key) {
        this.key = key;
    }

    public String getTime() {
        return time;
    }

    public void setTime(String time) {
        this.time = time;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }
}
